local chuanjiu = fk.CreateSkill{
  name = "rfenghou_3d13j__chuanjiu",
}

chuanjiu:addEffect("filter", {
  card_filter = function(self, to_select, player)
    return player:hasSkill(chuanjiu.name) and not player:isWounded() and (to_select.trueName == "peach" or to_select.trueName == "analeptic") and
    table.contains(player.player_cards[Player.Hand], to_select.id)
  end,
  view_as = function(self, player, to_select)
    return Fk:cloneCard("ex_nihilo", to_select.suit, to_select.number)
  end,
})

local filter = {
  can_refresh = function(self, event, target, player, data)
    return player == target and player:hasSkill(chuanjiu.name, true)
  end,
  on_refresh = function(self, event, target, player, data)
    player:filterHandcards()
  end,
}

chuanjiu:addEffect(fk.HpChanged, filter)
chuanjiu:addEffect(fk.MaxHpChanged, filter)

chuanjiu:addTest(function(room, me)
  local peach = room:printCard("peach")
  local analeptic = room:printCard("analeptic")

  FkTest.RunAddSkills(me, chuanjiu.name)

  --- test1: 获得桃和酒
  --- 期望: me的手牌全是无中生有
  FkTest.runInRoom(function ()
    room:obtainCard(me, { peach, analeptic })
  end)

  table.forEach(me:getCardIds("h"), function(cid)
    lu.assertEquals(Fk:getCardById(cid).name, "ex_nihilo")
  end)

  --- test2: me增加1点体力上限
  --- 期望: me的手牌回归原牌名
  -- FkTest.runInRoom(function ()
  --   room:changeMaxHp(me, 1)
  -- end)

  -- lu.assertEquals(Fk:getCardById(peach.id).name, "peach")
  -- lu.assertEquals(Fk:getCardById(analeptic.id).name, "analeptic")
  -- FIXME: 该测试中无法回归原名，但实际结算中正常
end)

Fk:loadTranslationTable{
  ["rfenghou_3d13j__chuanjiu"] = "荈酒",
  [":rfenghou_3d13j__chuanjiu"] = "锁定技，若你未受伤，你的【桃】与【酒】均视为【无中生有】。",
}

return chuanjiu
